__author__ = 'Totomo'

print("=============================九九乘法表while第一版=================================")
n=1
while n in range(1,10):
    m=1
    while m in range(1,10):
        if m==n:
            # print(str(n) + "x" + str(m) + "=" + str((n * m)).ljust(2)) #m和n相等时换行
            print("{:<6}".format((str(n) + "x" + str(m) + "=" + str(n * m)))) #format输出
            break
        else:
            print(str(n) + "*" + str(m) + "=" + str(n * m).ljust(2),end="  ")
        m += 1
    n += 1
print("=============================九九乘法表while第二版=================================")
n=9
while n in range(9,0,-1):
    m=1
    while m in range(1,10):
        if m==n:
            print(str(m) + "*" + str(n) + "=" + str(n * m).ljust(2))
            break
        else:
            print(str(m) + "*" + str(n) + "=" + str(n * m).ljust(2),end="  ")
        m += 1
    n -= 1
print("=============================九九乘法表while第三版=================================")
n=1
while n in range(1,10):
    m=9
    while m in range(9,0,-1):
        if (n==m or n>m) and m!=1:
            print((str(m) + "*" + str(n) + "=" + str(n * m)).rjust(6),end="  ")
        elif m==1:
            print((str(m) + "*" + str(n) + "=" + str(n * m)).rjust(6))
        else:
            print("        ",end="")
        m -= 1
    n += 1
print("=============================九九乘法表while第四版=================================")
n=9
while n in range(9,0,-1):
    m=9
    while m in range(9,0,-1):
        if (n==m or n>m) and m!=1:
            print((str(n) + "*" + str(m) + "=" + str(n * m)).rjust(6),end="  ")
        elif m==1:
            print((str(n) + "*" + str(m) + "=" + str(n * m)).rjust(6))
        else:
            print("        ",end="")
        m -= 1
    n -= 1